/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.trace;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "trace_tradeset_exchangelimit")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TraceTradesetExchangeLimit.findAll", query = "SELECT t FROM TraceTradesetExchangeLimit t"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findBySid", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.sid = :sid"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByTraceType", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.traceType = :traceType"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findById", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.id = :id"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByMarketCode", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.marketCode = :marketCode"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByUnderlyingObj", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.underlyingObj = :underlyingObj"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByCancelLimit", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.cancelLimit = :cancelLimit"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByOrderLimit", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.orderLimit = :orderLimit"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByOnceMaxQty", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.onceMaxQty = :onceMaxQty"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByReMark", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.reMark = :reMark"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByOwnUserID", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.ownUserID = :ownUserID"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByAlterUserID", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.alterUserID = :alterUserID"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByCreateTime", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.createTime = :createTime"),
    @NamedQuery(name = "TraceTradesetExchangeLimit.findByTimeStamp", query = "SELECT t FROM TraceTradesetExchangeLimit t WHERE t.timeStamp = :timeStamp")})
public class TraceTradesetExchangeLimit implements Serializable {
	public static byte[] EnCode(TraceTradesetExchangeLimit msg) throws IOException {
		Codec<TraceTradesetExchangeLimit> Lcode = ProtobufProxy.create(TraceTradesetExchangeLimit.class);
		return Lcode.encode(msg);
	}
	public static TraceTradesetExchangeLimit DeCode(byte[] data) throws IOException {
	Codec<TraceTradesetExchangeLimit> Lcode = ProtobufProxy.create(TraceTradesetExchangeLimit.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "sid")
    @Protobuf
	private Integer sid;
    @Basic(optional = false)
    @Column(name = "TraceType")
    @Protobuf
	private String traceType;
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private int id;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "UnderlyingObj")
    @Protobuf
	private String underlyingObj;
    @Basic(optional = false)
    @Column(name = "CancelLimit")
    @Protobuf
	private int cancelLimit;
    @Basic(optional = false)
    @Column(name = "OrderLimit")
    @Protobuf
	private int orderLimit;
    @Basic(optional = false)
    @Column(name = "OnceMaxQty")
    @Protobuf
	private int onceMaxQty;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public TraceTradesetExchangeLimit() {
    }

    public TraceTradesetExchangeLimit(Integer sid) {
        this.sid = sid;
    }

    public TraceTradesetExchangeLimit(Integer sid, String traceType, int id, String marketCode, int cancelLimit, int orderLimit, int onceMaxQty) {
        this.sid = sid;
        this.traceType = traceType;
        this.id = id;
        this.marketCode = marketCode;
        this.cancelLimit = cancelLimit;
        this.orderLimit = orderLimit;
        this.onceMaxQty = onceMaxQty;
    }

    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public String getTraceType() {
        return traceType;
    }

    public void setTraceType(String traceType) {
        this.traceType = traceType;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getUnderlyingObj() {
        return underlyingObj;
    }

    public void setUnderlyingObj(String underlyingObj) {
        this.underlyingObj = underlyingObj;
    }

    public int getCancelLimit() {
        return cancelLimit;
    }

    public void setCancelLimit(int cancelLimit) {
        this.cancelLimit = cancelLimit;
    }

    public int getOrderLimit() {
        return orderLimit;
    }

    public void setOrderLimit(int orderLimit) {
        this.orderLimit = orderLimit;
    }

    public int getOnceMaxQty() {
        return onceMaxQty;
    }

    public void setOnceMaxQty(int onceMaxQty) {
        this.onceMaxQty = onceMaxQty;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
        this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sid != null ? sid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TraceTradesetExchangeLimit)) {
            return false;
        }
        TraceTradesetExchangeLimit other = (TraceTradesetExchangeLimit) object;
        if ((this.sid == null && other.sid != null) || (this.sid != null && !this.sid.equals(other.sid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.trace.TraceTradesetExchangeLimit[ sid=" + sid + " ]";
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }
    
}
